# the minimum version of CMake.
cmake_minimum_required(VERSION 3.5.0)
project(MyApplication VERSION 1.0)

option (USE_MYMATH "Use tutorial provided math implementation" ON)

set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)

include (CheckSymbolExists)
set(CMAKE_REQUIRED_LIBRARIES "m")
check_symbol_exists(log "math.h" HAVE_LOG)
check_symbol_exists(exp "math.h" HAVE_EXP)

if(DEFINED PACKAGE_FIND_FILE)
    include(${PACKAGE_FIND_FILE})
endif()

include_directories(${NATIVERENDER_ROOT_PATH}
                    ${NATIVERENDER_ROOT_PATH}/include)
ADD_DEFINITIONS(-DVK_USE_PLATFORM_OHOS=1)
add_library(entry SHARED napi_init.cpp)
target_compile_definitions(entry PUBLIC "USE_MYMATH")
if(HAVE_LOG AND HAVE_EXP)
   target_compile_definitions(entry PUBLIC "HAVE_LOG" "HAVE_EXP")
endif()
target_link_libraries(entry PUBLIC libace_napi.z.so libhilog_ndk.z.so libuv.so libnative_window.so libvulkan.so)